<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

/*
Route::get('/', function () {
    return view('welcome');
});
*/

Route::get('login', 'Auth\LoginController@showLoginForm')->name('login');
Route::post('login', 'Auth\LoginController@login');
Route::post('logout', 'Auth\LoginController@logout')->name('logout');

// 用户注册相关路由
Route::get('register', 'Auth\RegisterController@showRegistrationForm')->name('register');
Route::post('register', 'Auth\RegisterController@register');

// 密码重置相关路由
Route::get('password/reset', 'Auth\ForgotPasswordController@showLinkRequestForm')->name('password.request');
Route::post('password/email', 'Auth\ForgotPasswordController@sendResetLinkEmail')->name('password.email');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.reset');
Route::post('password/reset', 'Auth\ResetPasswordController@reset')->name('password.update');

// Email 认证相关路由
Route::get('email/verify', 'Auth\VerificationController@show')->name('verification.notice');
Route::get('email/verify/{id}', 'Auth\VerificationController@verify')->name('verification.verify');
Route::get('email/resend', 'Auth\VerificationController@resend')->name('verification.resend');

Route::get('/', 'HomeController@index')->name('home');
Route::get('users/warning', 'UsersController@warning')->name('users.warning');
Route::resource('users', 'UsersController');

Route::get('sites/user/{member}', 'SitesController@index')->name('sites.member');
Route::resource('sites', 'SitesController');
Route::post('ads/create/{site}', 'AdsController@create')->name('ads.create');
Route::resource('ads', 'AdsController',  ['except' => 'create']);

Route::resource('videos', 'VideosController',  ['only' => ['index', 'edit', 'update', 'create', 'store', 'destroy']]);

Route::get('settings/edit', 'SettingsController@edit')->name('settings.edit');
Route::put('settings/update', 'SettingsController@update')->name('settings.update');

Route::resource('notices', 'NoticesController', ['only' => ['index', 'show', 'create', 'store', 'update', 'edit', 'destroy']]);
Route::resource('domains', 'DomainsController', ['only' => ['index', 'show', 'create', 'store', 'update', 'edit', 'destroy']]);

Route::get('members/login_logs', 'MembersController@login_logs')->name('members.login_logs');
Route::resource('members', 'MembersController');
Route::post('members/{member}/ban', 'MembersController@ban')->name('members.ban');

Route::get('sites/{site}/short_url', 'SitesController@short_url')->name('sites.short_url');

Route::post('short_urls/site/{site?}', 'ShortUrlsController@create')->name('short_urls.create');
Route::post('short_urls/site/{site}/random', 'ShortUrlsController@create_random')->name('short_urls.create_random');
Route::post('short_urls/site/{site}/fixed', 'ShortUrlsController@create_fixed')->name('short_urls.create_fixed');
Route::get('share_urls', 'ShortUrlsController@share')->name('share_short_urls');
// Route::resource('short_urls', 'ShortUrlsController', ['only' => ['index', 'show', 'store', 'update', 'edit', 'destroy']]);
Route::get('short_urls/{site?}', 'ShortUrlsController@show')->name('short_urls.show');

Route::get('views/test', 'ViewsController@zhuaqu')->name('views.test');

Route::get('view/{site}/{title?}', 'HomeController@show');
Route::get('view_site/{site}', 'HomeController@view_site')->name('home.view_site');

//Route::resource('view_counts', 'ViewCountsController', ['only' => ['index', 'show', 'create', 'store', 'update', 'edit', 'destroy']]);
Route::get('view_counts/user/{member?}', 'ViewCountsController@user')->name('view_counts.user');
Route::get('view_counts/show/{member?}', 'ViewCountsController@show')->name('view_counts.show');
Route::get('view_counts/show/{member?}', 'ViewCountsController@show')->name('view_counts.show');
Route::get('view_counts/sum', 'ViewCountsController@sum')->name('view_counts.sum');
Route::get('view_counts/', 'ViewCountsController@index')->name('view_counts.index');
Route::delete('view_counts/destroy', 'ViewCountsController@destroy')->name('view_counts.destroy');

Route::resource('feed_backs', 'FeedBackController', ['only' => ['index', 'show', 'create', 'store', 'update', 'edit', 'destroy']]);

Route::post('ads/update_all/site/{site}', 'AdsController@update_all')->name('ads.update_all');
